<?php
/**
 * Created by PhpStorm.
 * User: tony-liu
 * Date: 2019/3/11
 * Time: 21:58
 */
namespace api\modules\openapi\components\form;

use Yii;
use yii\base\Model;
use api\components\helpers\Constant;

class CampaignForm extends Model {
    public $advertiser_id;
    public $page;
    public $per_page;
    public $status;
    public $ids;
    public $start_date;
    public $end_date;
    
    public function rules()
    {
        return [
            ['advertiser_id','required','message'=>'缺少参数advertiser_id'],
            [['advertiser_id'],'integer','message'=>'参数advertiser_id格式不正确'],
            ['page','integer','message'=>'参数page格式不正确'],
            ['per_page','integer','message'=>'参数per_page格式不正确'],
            ['status','integer','message'=>'参数status格式不正确'],
            ['start_date','date','format'=>'yyyy-mm-dd','message'=>'参数start_date格式不正确'],
            ['end_date','date','format'=>'yyyy-mm-dd','message'=>'参数end_date格式不正确'],
            ['status','in','range' => array(Constant::STATUS_INVALID, Constant::STATUS_VALID),'message'=>'status传参不在范围之内'],
            ['page','default','value'=>1],
            ['per_page','default','value'=>30],
            ['per_page','integer','max'=>500,'message'=>'每页最多返回500个']
        ];
    }
    
}